import React from 'react';
import renderer from 'react-test-renderer';
import Link from './LinkComponent';

describe('baseComponent', () => {
  it('Link changes the class when hovered', () => {
    const component = renderer.create(
      <Link page="http://www.keruyun.com">keruyun</Link>
    );
    let tree = component.toJSON();
    expect(tree).toMatchSnapshot();

    // manually trigger the callback
    tree.props.onMouseEnter();
    // re-rendering
    tree = component.toJSON();
    expect(tree).toMatchSnapshot();

    // manually trigger the callback
    tree.props.onMouseLeave();
    // re-rendering
    tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
});
